<?php 
include 'common.php';
$id = $_GET['id'];
$sql  = "SELECT * FROM publish WHERE id = '{$id}'";
$row = select($sql,$DB);
$quantity = 0;
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>知趣论坛</title>
	<link href="<?=$website['public'];?>/web/base.css" rel="stylesheet" type="text/css"/>
	<link href="<?=$website['public'];?>/web/requer.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="top">
	<div class="auto">
		<div class="nav">
			<img src="<?=$website['public'];?>/web/img/logo.png" style="width:30px; height:25px;margin:13px;" />
			<a href="../index.php">首页</a>
			<a href="/web/discus.php">讨论</a>
			<a href="/web/answers.php">问答</a>
			<a href="/web/node.php">节点</a>
			<a href="/web/tag.php">标签</a>
			<input type="text" name="name" placeholder="搜索" autocomplete="off" class="input">
			<div class="login right"><?php if ($_COOKIE['name']) {
				echo ($_COOKIE['name']);
			?>
			<a href="/web/logout.php?logout=1">退出登录</a>
			<?php
			} else { ?>
			<a href="/web/login.php">登录</a>
			<?php
			}
			 ?></div>
		</div>
	</div>
</div>
<div class="main fn-clear">
	<div class="bigbj auto">
		<div class="bj_l left">
			<div class="am_panel ">
				<div class="list left">
					<h1><?php echo $row[0]['title']; ?></h1>
					<div class="info left">
					<?php echo "程序发布 · 发表人: ".$row[0]['name']." · 发表时间: ".date('Y-m-d H:i:s',$row[0]['hour'])." · 最后回复由風雲于3月前·1718阅读" ?>
					</div>
				</div>
				<div class="markdown left">
					<p><?php echo $row[0]['content']; ?></p>
				</div>
				<div class="footer left">
					<img src="<?=$website['public'];?>/web/img/17.gif" style="width:40px;height:35px;">
					<img src="<?=$website['public'];?>/web/img/18.jpg" style="width:40px;height:35px;">
					<img src="<?=$website['public'];?>/web/img/19.jpg" style="width:40px;height:35px;">
					<img src="<?=$website['public'];?>/web/img/20.jpg" style="width:40px;height:35px;">
					<img src="<?=$website['public'];?>/web/img/21.jpg" style="width:40px;height:35px;">
				</div>
			</div>
				<?php
				$sss = "SELECT COUNT(*) FROM publish_revert WHERE publish_id = '{$id}'";
				$number = select($sss,$DB);		
				?>
				<div class="panel_hf">回复数量: <?php echo $number[0]['COUNT(*)'];  ?></div>
				<?php 
				$sql = "SELECT * FROM publish_revert WHERE publish_id = '{$id}'";
				$revert_row = select($sql,$DB);
				foreach ($revert_row as $key => $value) {
				?>
				<div class="two_panel fn-clear">
				<div class="tupian left">
					<img src="<?=$website['public'];?>/web/img/16.png" style="width:55px;height:55px;">
				</div>
				<div class="infor_us left">
					<div class="infor-head left"><?php echo $value['name'] ?></div>
					<div class="infor-head left"><?php echo $value['content'] ?></div>
				</div>
				</div>	
				<?php }?>
				<ul class="waring">
					<li>请注意单词拼写,以及中英文排版,参考此页</li>
					<li>支持Markdown格式**粗体**丶~~删除线丶'单行代码',更多语法请见这里 Markdown语法</li>
					<li>上传图片,需要上传至图床</li>
					<li>发布框支持本地储存功能,会在内容变更时保存,[提交]按钮点击时清空</li>
				</ul>
			<form action="judge/requer_if.php" method="post" class="zhiqu left">
				<input type="hidden" name="publish_id" value="<?php echo $row[0]['id'] ?>">
				<input type="hidden" name="publish_name" value="<?php echo $row[0]['name'] ?>">
				<textarea class="pinglun" name="content"></textarea>
				<div class="statusbar">Autosaved: 2:58 pm 0:0</div>
				<button class="button right">回复</button>
			</form>
		</div>
		<div class="bj_r right">
			<div class="one_list">
				<div class="user">Mr L</div>
				<img src="<?=$website['public'];?>/web/img/5.png" style="width:80px;height:80px;">  
			</div>
			<div class="two_list">
				<div class="user">TA的其他话题</div>
			</div>
			<div class="two_list">
				<div class="user">节点下的其他话题</div>
			</div>
		</div>
	</div>
</div>
<div class="bottom">
	<div class="bottom_table auto">© 2016 DuxPHP, Inc. Licensed under 0.0213s</div>
</div>
</body>
</html>